<template>
  <div id="demo"></div>
</template>

<script>
import * as echarts from "echarts";

var myChart = echarts.init(document.querySelector("#demo"));

let data = [];
let now = new Date(1997, 9, 3);
let oneDay = 24 * 3600 * 1000;
let value = Math.random() * 1000;
for (var i = 0; i < 1000; i++) {
  // data.push(randomData());
  now = new Date(now.getTime() + oneDay);
  value = value + Math.random() * 1000;
  data.push({
    name: now.toString(),
    value: [
      [now.getFullYear(), now.getMonth() + 1, now.getDate()].join("/"), //x轴
      Math.round(value),
    ],
  });
}
console.log("data", data);

var option = {
  title: {
    text: "仪表盘",
    textStyle: {
      fontSize: 15,
    },
    tooltip: {
      trigger: "axis",
      formatter: function (params) {
        console.log(params);
        return "hhh";
      },
      axisPointer: {
        Animation: false,
      },
    },
    xAxis: {
      type: "time",
      splitLine: {
        show: false,
      },
    },
    yAxis: {
      type: "value",
      splitLine: {
        show: false,
      },
      boundaryGap: [0, "100%"],
    },
    series: [
      {
        name: "飘飘句",
        type: "line",
        data: data,
      },
    ],
  },
};

myChart.setOption(option);

// export default {

// };
</script>